<?php
/**
 * Implementation of hook_insert. 
 * Responds to node insertion.
 */
function race_insert($node) {
  db_query("INSERT INTO {race} (vid, nid, config, signup, assignment, state) VALUES (%d, %d, '%s', '%s', '%s', %d)",
    $node->vid,
    $node->nid,
    $node->config,
    $node->signup,
    $node->assignment,
    $node->state);
}

/**
 * Implementation of hook_update(). 
 * Responds to node updating.
 */
function race_update($node) {
  db_query("UPDATE {race} SET config = '%s', signup='%s', assignment='%s', state=%d WHERE vid =%d",
    $node->config,
    $node->signup,
    $node->assignment,
    $node->state,
    $node->vid);
}

/**
 * Implementation of hook_load().
 * Load node-type-specific information.
 */
function race_load($node) {
  $additions = db_fetch_object(db_query('SELECT config, signup, assignment, state FROM {race} WHERE vid = %d', $node->vid));
  return $additions;
}


